<?php
	class views extends Library {
		var $view;
		var $vars;
		function __construct()
		{
			parent::__construct();
		}
		function load($view,$vars=array(),$return=false)
		{
			$this->view = $view; unset($view);
			$this->vars = ($vars==false) ? array() : $vars; unset($vars);
			
			debug("Loading view: ".$this->view."");
			if(!is_array($this->vars))
			{
				error("Only an array should be passed as the second argument to view::load()");
				$this->vars = array();
			}
			foreach ( $this->vars as $name => $value )
			{
				$$name = $value;
			}
			ob_start();
			include(VIEWDIR.$this->view.".php");
			$out = ob_get_contents();
			@ob_end_clean();
			if($return===true){return $out;}
			else { echo $out; }
		}
		function __toString()
		{
			return "views";
		}
	}
?>